// 基于template/src/widgets/{{appEntities}}/{{ctrls@GRID}}-grid/{{spinalCase ctrl.codeName}}-grid-model.ts.hbs生成
import { IGridModel, IParam, isEmpty, VerifyUtil } from '@/core';

function getModel(): IGridModel {
	return {
		cssName: '',
		aggMode: 'NONE',
		caption: '',
		controlType: 'GRID',
		codeName: 'PersonGridView_Grid',
		columns: getGridColumns(),
		dataItems: getGridDataItems(),
		dataExport: getDataExport(),
		enableRowEdit: false,
		entityCodeName: 'Sys_role_member',
		entityLogicName: '系统角色成员',
		createDefaultItems: getCreateDefaultItems(),
		updateDefaultItems: getUpdateDefaultItems(),
		name: 'grid',
		noSort: false,
		rules: {
			//	静态值规则
			staticRules: {},
			//	编辑项值规则
			editRules: [],
		},
		showHeader: true,
		sortDir: '',
		sortField: '',
		limit: 20,
		paging: {
			defaultPageSize: 20,
		},
		uiEngineModel: [
			{
				name: 'engine_grid',
				triggerType: 'CTRLEVENT',
				logicType: 'APPVIEWENGINE',
				eventNames: 'ROWDBLCLICK;SELECTIONCHANGE;REMOVE;LOAD;BEFORELOAD',
				scriptCode: ``,
				entityCodeName: '',
				logicName: ``,
			},
		],
	};
}
//  获取所有表格列模型
function getGridColumns(): IParam[] {
	return [
		{
			align: 'left',
			codeName: 'member_type',
			caption: '成员类型',
			captionLanResTag: '',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
			valueType: 'SIMPLE',
			codeListTag: 'ad__Sys_cn_type',
			dataItemName: 'member_type',
			dataIndex: 'member_type',
			sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
			filterName: '',
			filterCodeListTag: '',
			filterCodeListType: '',
			enableSort: true,
			excelCaption: '成员类型',
			headerCssName: '',
			show: true,
			hiddenDataItem: false,
			name: 'member_type',
			width: 200,
			minWidth: 200,
			resizable: true,
			stdDataType: 25,
			valueFormat: '',
		},
		{
			align: 'left',
			codeName: 'member_group_name',
			caption: '成员分组名称',
			captionLanResTag: '',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
			valueType: 'SIMPLE',
			dataItemName: 'member_group_name',
			dataIndex: 'member_group_name',
			sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
			filterName: '',
			filterCodeListTag: '',
			filterCodeListType: '',
			enableSort: true,
			excelCaption: '成员分组名称',
			headerCssName: '',
			show: true,
			hiddenDataItem: false,
			name: 'member_group_name',
			width: 250,
			minWidth: 250,
			resizable: true,
			stdDataType: 25,
			valueFormat: '',
		},
		{
			align: 'left',
			codeName: 'role_name',
			caption: '系统角色名称',
			captionLanResTag: '',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
			valueType: 'SIMPLE',
			dataItemName: 'role_name',
			dataIndex: 'role_name',
			sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
			filterName: '',
			filterCodeListTag: '',
			filterCodeListType: '',
			enableSort: true,
			excelCaption: '系统角色名称',
			headerCssName: '',
			show: true,
			hiddenDataItem: false,
			name: 'role_name',
			width: 250,
			minWidth: 250,
			resizable: true,
			stdDataType: 25,
			valueFormat: '',
		},
		{
			align: 'left',
			codeName: 'role_authority',
			caption: '角色标记',
			captionLanResTag: '',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
			valueType: 'SIMPLE',
			dataItemName: 'role_authority',
			dataIndex: 'role_authority',
			sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
			filterName: '',
			filterCodeListTag: '',
			filterCodeListType: '',
			enableSort: true,
			excelCaption: '角色标记',
			headerCssName: '',
			show: true,
			hiddenDataItem: false,
			name: 'role_authority',
			width: 250,
			minWidth: 250,
			resizable: true,
			stdDataType: 25,
			valueFormat: '',
		},
		{
			align: 'left',
			codeName: 'deploy_system_id',
			caption: '系统标识',
			captionLanResTag: '',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
			valueType: 'SIMPLE',
			dataItemName: 'deploy_system_id',
			dataIndex: 'deploy_system_id',
			sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
			filterName: '',
			filterCodeListTag: '',
			filterCodeListType: '',
			enableSort: true,
			excelCaption: '系统标识',
			headerCssName: '',
			show: false,
			hiddenDataItem: false,
			name: 'deploy_system_id',
			width: 250,
			minWidth: 250,
			resizable: true,
			stdDataType: 25,
			valueFormat: '',
		},
		{
			align: 'left',
			codeName: 'create_time',
			caption: '创建时间',
			captionLanResTag: 'DEF.LNAME.CREATE_TIME',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
			valueType: 'SIMPLE',
			dataItemName: 'create_time',
			dataIndex: 'create_time',
			sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
			filterName: '',
			filterCodeListTag: '',
			filterCodeListType: '',
			enableSort: true,
			excelCaption: '创建时间',
			headerCssName: '',
			show: true,
			hiddenDataItem: false,
			name: 'create_time',
			width: 250,
			minWidth: 250,
			resizable: true,
			stdDataType: 5,
			valueFormat: 'YYYY-MM-DD HH:mm:ss',
		},
		{
			align: 'left',
			codeName: 'update_time',
			caption: '最后更新时间',
			captionLanResTag: 'DEF.LNAME.UPDATE_TIME',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
			valueType: 'SIMPLE',
			dataItemName: 'update_time',
			dataIndex: 'update_time',
			sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
			filterName: '',
			filterCodeListTag: '',
			filterCodeListType: '',
			enableSort: true,
			excelCaption: '最后更新时间',
			headerCssName: '',
			show: true,
			hiddenDataItem: false,
			name: 'update_time',
			width: 250,
			minWidth: 250,
			resizable: true,
			stdDataType: 5,
			valueFormat: 'YYYY-MM-DD HH:mm:ss',
		},
		{
			align: 'left',
			codeName: 'member_uid',
			caption: '用户组/人员标识',
			captionLanResTag: '',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
			valueType: 'SIMPLE',
			dataItemName: 'member_uid',
			dataIndex: 'member_uid',
			sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
			filterName: '',
			filterCodeListTag: '',
			filterCodeListType: '',
			enableSort: true,
			excelCaption: '用户组/人员标识',
			headerCssName: '',
			show: false,
			hiddenDataItem: false,
			name: 'member_uid',
			width: 150,
			minWidth: 150,
			resizable: true,
			stdDataType: 25,
			valueFormat: '',
		},
		{
			align: 'left',
			codeName: 'member_group_id',
			caption: '成员分组标识',
			captionLanResTag: '',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
			valueType: 'SIMPLE',
			dataItemName: 'member_group_id',
			dataIndex: 'member_group_id',
			sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
			filterName: '',
			filterCodeListTag: '',
			filterCodeListType: '',
			enableSort: true,
			excelCaption: '成员分组标识',
			headerCssName: '',
			show: false,
			hiddenDataItem: false,
			name: 'member_group_id',
			width: 150,
			minWidth: 150,
			resizable: true,
			stdDataType: 25,
			valueFormat: '',
		},
		{
			align: 'left',
			codeName: 'id',
			caption: '标识',
			captionLanResTag: '',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
			valueType: 'SIMPLE',
			dataItemName: 'id',
			dataIndex: 'id',
			sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
			filterName: '',
			filterCodeListTag: '',
			filterCodeListType: '',
			enableSort: true,
			excelCaption: '标识',
			headerCssName: '',
			show: false,
			hiddenDataItem: false,
			name: 'id',
			width: 150,
			minWidth: 150,
			resizable: true,
			stdDataType: 25,
			valueFormat: '',
		},
		{
			align: 'left',
			codeName: 'role_id',
			caption: '系统角色标识',
			captionLanResTag: '',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
			valueType: 'SIMPLE',
			dataItemName: 'role_id',
			dataIndex: 'role_id',
			sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
			filterName: '',
			filterCodeListTag: '',
			filterCodeListType: '',
			enableSort: true,
			excelCaption: '系统角色标识',
			headerCssName: '',
			show: false,
			hiddenDataItem: false,
			name: 'role_id',
			width: 150,
			minWidth: 150,
			resizable: true,
			stdDataType: 25,
			valueFormat: '',
		},
		{
			align: 'center',
			codeName: 'uagridcolumn1',
			caption: '操作',
			captionLanResTag: '',
			cellCssName: '',
			columnType: 'UAGRIDCOLUMN',
			dataItemName: 'uagridcolumn1',
			dataIndex: 'uagridcolumn1',
			enableRowEdit: false,
			customFilterDropdown: false,
			filterName: '',
			filterCodeListTag: '',
			filterCodeListType: '',
			enableSort: false,
			excelCaption: '',
			headerCssName: '',
			show: true,
			hiddenDataItem: false,
			name: 'uagridcolumn1',
			width: 150,
			minWidth: 150,
			fixed: 'right',
			valueFormat: '',
			uIActionDetails: [
				{
					name: 'u33a6417',
					caption: '收回授权',
					showIcon: true,
					showCaption: true,
					separator: false,
					uIActionTag: 'personUnAuth',
					noPrivDisplayMode: 2,
					dataAccessAction: 'UNAUTH',
					actionTarget: 'SINGLEKEY',
					uIActionMode: 'FRONT',
					disabled: false,
					visible: true,
					logic: {
						name: 'grid_uagridcolumn1_u33a6417_click',
						actionTag: 'personUnAuth',
						actionDECodeName: 'Sys_role_member',
						predefinedType: '',
					},
					iconClass: 'fa fa-rotate-left',
				},
			],
		},
	];
}

//  获取所有表格数据项
function getGridDataItems() {
	return [
		{
			name: 'member_type',
			codeName: '',
			customCode: false,
			fieldCodeName: 'member_type',
			fieldName: 'member_type',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'member_group_name',
			codeName: '',
			customCode: false,
			fieldCodeName: 'member_group_name',
			fieldName: 'member_group_name',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'role_name',
			codeName: '',
			customCode: false,
			fieldCodeName: 'role_name',
			fieldName: 'role_name',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'role_authority',
			codeName: '',
			customCode: false,
			fieldCodeName: 'role_authority',
			fieldName: 'role_authority',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'deploy_system_id',
			codeName: '',
			customCode: false,
			fieldCodeName: 'deploy_system_id',
			fieldName: 'deploy_system_id',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'create_time',
			codeName: '',
			customCode: false,
			fieldCodeName: 'create_time',
			fieldName: 'create_time',
			valueFormat: 'YYYY-MM-DD HH:mm:ss',
			dataType: '5',
		},
		{
			name: 'update_time',
			codeName: '',
			customCode: false,
			fieldCodeName: 'update_time',
			fieldName: 'update_time',
			valueFormat: 'YYYY-MM-DD HH:mm:ss',
			dataType: '5',
		},
		{
			name: 'member_uid',
			codeName: '',
			customCode: false,
			fieldCodeName: 'member_uid',
			fieldName: 'member_uid',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'member_group_id',
			codeName: '',
			customCode: false,
			fieldCodeName: 'member_group_id',
			fieldName: 'member_group_id',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'id',
			codeName: '',
			customCode: false,
			fieldCodeName: 'id',
			fieldName: 'id',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'role_id',
			codeName: '',
			customCode: false,
			fieldCodeName: 'role_id',
			fieldName: 'role_id',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'srfkey',
			codeName: '',
			customCode: false,
			fieldCodeName: 'id',
			fieldName: 'id',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'srfdataaccaction',
			codeName: '',
			customCode: false,
			fieldCodeName: 'id',
			fieldName: 'id',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'srfmajortext',
			codeName: '',
			customCode: false,
			fieldCodeName: 'id',
			fieldName: 'id',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'srfmstag',
			codeName: '',
			customCode: false,
		},
	];
}

function getDataExport() {
	return {
		default: true,
		codeName: 'default',
		enableFront: true,
		fileName: '系统角色成员',
		exportItems: [
			{
				name: 'member_type',
				label: '成员类型',
				labelLanResTag: '',
				dataType: 25,
				codeListTag: 'ad__Sys_cn_type',
				show: true,
			},
			{
				name: 'member_group_name',
				label: '成员分组名称',
				labelLanResTag: '',
				dataType: 25,
				show: true,
			},
			{
				name: 'role_name',
				label: '系统角色名称',
				labelLanResTag: '',
				dataType: 25,
				show: true,
			},
			{
				name: 'role_authority',
				label: '角色标记',
				labelLanResTag: '',
				dataType: 25,
				show: true,
			},
			{
				name: 'deploy_system_id',
				label: '系统标识',
				labelLanResTag: '',
				dataType: 25,
				show: false,
			},
			{
				name: 'create_time',
				label: '创建时间',
				labelLanResTag: 'DEF.LNAME.CREATE_TIME',
				dataType: 5,
				valueFormat: 'YYYY-MM-DD HH:mm:ss',
				show: true,
			},
			{
				name: 'update_time',
				label: '最后更新时间',
				labelLanResTag: 'DEF.LNAME.UPDATE_TIME',
				dataType: 5,
				valueFormat: 'YYYY-MM-DD HH:mm:ss',
				show: true,
			},
			{
				name: 'member_uid',
				label: '用户组/人员标识',
				labelLanResTag: '',
				dataType: 25,
				show: false,
			},
			{
				name: 'member_group_id',
				label: '成员分组标识',
				labelLanResTag: '',
				dataType: 25,
				show: false,
			},
			{
				name: 'id',
				label: '标识',
				labelLanResTag: '',
				dataType: 25,
				show: false,
			},
			{
				name: 'role_id',
				label: '系统角色标识',
				labelLanResTag: '',
				dataType: 25,
				show: false,
			},
		],
	};
}

function getCreateDefaultItems() {
	return [];
}

function getUpdateDefaultItems() {
	return [];
}

export const model = getModel();
